package s14.ch16.ex3;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

public class ShiftInputFilter extends FilterInputStream {
	private Integer shift;

	public ShiftInputFilter(InputStream in, Integer i) {
		super(in);
		setShift(i);
	}

	public int read() throws IOException {
		
		Integer read = super.read();
		if (read==-1){
			return -1;
		}
			
		Integer result = read + shift;
		System.out.println(result);
		return result;
	}

	public Integer getShift() {
		return shift;
	}

	public void setShift(Integer shift) {
		this.shift = shift;
	}

}
